package main

import "fmt"

type Animal struct { //父类
	name string
	age  int
}

type Cat struct { // 子类
	// name  string
	// age   int
	Animal // 继承
	age    int
	color  string
}

type Dog struct {
	name string
	age  int
	xxx  string
}

func main() {
	// var c1 = Cat{"xiaobai", 3, "black"}
	// fmt.Printf("%+v\n", c1)
	var c1 = Cat{}
	fmt.Println(c1.color, c1.Animal.name, c1.Animal.age, c1.name, c1.age)
	c1.Animal.name = "tom"
	c1.name = "jerry"
	c1.age = 6
	c1.color = "black"
	fmt.Println(c1.color, c1.Animal.name, c1.Animal.age, c1.name, c1.age)
	fmt.Println(c1)

}
